import Vue from 'vue';
import Vuex from 'vuex';
import lodash from 'lodash';
import { getMailCount } from '@/api/business/tbMail';
Vue.use(Vuex)
const state = {
	messageCount: 0,
}
const getters = {}
const actions = {
	//获取未读信息数量
	async getUnreadMailCount({ commit }, auth) {
		let result = await getMailCount().then(res => res.data);
		if (result.code === '0') {
			commit('SET_UNREADMAIL_COUNT', Number(result.msg));
		} else {
			Promise.reject(new Error('faile'));
		}
	}
}
const mutations = {
	SET_UNREADMAIL_COUNT: (state, d) => {
		state.messageCount = d;
	}
}
export default { state, getters, actions, mutations }